<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
	<title>商品管理</title>
</head>
<body>
<jsp:include page="../frame.jsp" />
<div class="main-content">
	<div class="main-content-inner">
		<div class="breadcrumbs ace-save-state" id="breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="${pageContext.request.contextPath}/statistics">首页</a>
				</li>
				<li class="active">商品管理</li>
			</ul><!-- /.breadcrumb -->

			<div class="nav-search" id="nav-search">
				<form class="form-search" action="#">
                    <span class="input-icon">
                        <input type="text" placeholder="搜索" class="nav-search-input" id="nav-search-input" autocomplete="off" />
                        <i class="ace-icon fa fa-search nav-search-icon"></i>
                    </span>
				</form>
			</div><!-- /.nav-search -->
		</div>

		<div class="page-content">
			<div class="page-header">
				<h1>
					商品管理
					<small>
						<i class="ace-icon fa fa-angle-double-right"></i>
						商品列表
					</small>
				</h1>
			</div><!-- /.page-header -->

			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="table-header">
								商品详情列表
							</div>

							<div class="col-xs-12">
								<h3>${msg}</h3>
								<div class="tab-content table-responsive">
									<c:if test="${fn:length(products) > 0}">
										<div class="table-responsive">
											<table class="table table-bordered" style="text-align: center;">
												<tbody>
												<tr style="font-weight: bold;">
													<td>商品图片</td>
													<td>商品名称</td>
													<td>商品单价</td>
													<td>商品描述</td>
													<td>上架时间</td>
													<td>操作</td>
												</tr>
												<c:forEach items="${products }" var="product">
													<tr>
														<td width="60" width="40%" style="vertical-align: middle;">
															<img src="${pageContext.request.contextPath}/${product.pimage}" width="70" height="60">
														</td>
														<td width="30%" style="vertical-align: middle;">
															<a target="_blank" href="${pageContext.request.contextPath}/product?method=productDetails&pid=${product.pid}">${product.pname}</a>
														</td>
														<td width="20%" style="vertical-align: middle;">
															￥${product.shop_price}
														</td>
														<td width="10%" style="vertical-align: middle;">
																${product.pdesc}
														</td>
														<td width="15%" style="vertical-align: middle;">
															<span class="subtotal">
																${fn:substringBefore(product.pdate," ")}
															</span>
														</td>
														<td style="vertical-align: middle;">

															<a href="${pageContext.request.contextPath}/productManage?method=editProductPage">
																<i class="fa fa-plus"></i>
															</a>

															<a href="${pageContext.request.contextPath}/productManage?method=editProductPage&pid=${product.pid}" title="修改">
																<i class="fa fa-pencil-square-o green"></i>
															</a>

															<a href="${pageContext.request.contextPath}/productManage?method=deleteProduct&pid=${product.pid}" class="delete" title="删除">
																<i class="fa fa-trash-o" style="color: red;"></i>
															</a>
														</td>
													</tr>
												</c:forEach>
												</tbody>
											</table>
										</div>
									</c:if>
									<c:if test="${fn:length(products) <= 0}">
										<h3>暂无商品数据，请<a href="${pageContext.request.contextPath}/productManage?method=editProductPage">先添加几条</a></h3>
									</c:if>
								</div>
							</div>
						</div>
					</div>
					<!-- PAGE CONTENT ENDS -->
				</div><!-- /.col -->
			</div>
		</div>
	</div>
</div>
</body>
</html>